Feature: 创建咨询
  作为一个律团用户
  我可以咨询律师
  这样我可以得到我想知道的法律知识

Background:
Given http "accept" header is "application/json"
  And I make a "post" request to "login" with:
        | username    | password   |
        | 13702325511 | 123456   |
  And the response is in "json" format
  And http "authorization" header exists

# 不成功

Scenario: 如果提交的咨询没有法律类别cat_id，则系统会报400错
  And I make a "post" request to "question/create" with:
    | cat_id    | title | content |
    |           |  12       |    fgfgffgf            |
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "请选择法律类别" for field "cat_id"

  Scenario: 如果提交的咨询没有内容，则系统会报400错
  And I make a "post" request to "question/create" with:
    | cat_id    | title | content |
    |           |  12       |    fgfgffgf            |
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "请填写咨询内容" for field "content"

  Scenario: 如果提交的咨询没有标题，则系统会报400错
  And I make a "post" request to "question/create" with:
    | cat_id    | title | content |
    |           |  12       |    fgfgffgf            |
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "请填写咨询标题" for field "title"

Scenario: 如果提交的咨询的附件不是以数组的格式，则系统会报400错
 And I make a "post" request to "question/create" with:
  | cat_id    | title | content |  file_paths  |
  |       1     |  1212      |    ggggggggt   |  huhu |
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "上传的文件列表要是数组的格式" for field "file_paths"

Scenario: 如果提交的咨询附带了超过2个附件，则系统会报400错( 前台有控制，后台并没有控制)
And I make a "post" request to "question/create" with:
  | cat_id    | title | content |  file_paths  |
  |       1     |  1212      |    ggggggggt   |  ["1","2","3"] |
And the response is in "json" format
Then the response status code should be 400

Scenario: 如果尝试浏览一个不存在的咨询，则系统会报404错
Given I am on "/question/1791"
And the response is in "json" format
Then the response status code should be 404
And I see error message "没有找到符合要求的纪录。" for field "message"

# 成功

Scenario: 可以成功创建咨询，并且上传文件
And I make a "post" request to "question/create" with:
  | cat_id    | title | content |
  |       1     |  1212      |    ggggggggt   |
And the response is in "json" format
Then the response status code should be 201

Scenario: 可以成功浏览一个咨询
Given I am on "/question/360"
And the response is in "json" format
Then the response status code should be 200